package com.ekuaitu.kuaitu.activity;

import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.api.ApiStore;
import com.ekuaitu.kuaitu.api.UrlConstant;
import com.ekuaitu.kuaitu.base.BaseActivity;
import com.ekuaitu.kuaitu.bean.CommitInvoiceBean;
import com.ekuaitu.kuaitu.utils.MyApplication;
import com.ekuaitu.kuaitu.utils.SharedPreferencesUtils;
import com.ekuaitu.kuaitu.utils.StatusBarUtil;
import com.ekuaitu.kuaitu.utils.Toast.ToastCompat;
import com.zhy.autolayout.AutoLinearLayout;
import com.zhy.autolayout.AutoRelativeLayout;

import butterknife.BindView;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class InvoiceSettlementActivity extends BaseActivity {

    @BindView(R.id.return_myInvoice_commit)
    ImageView returnMyInvoiceCommit;
    @BindView(R.id.toolbar_myInvoice_commit)
    AutoRelativeLayout toolbarMyInvoiceCommit;
    @BindView(R.id.invoice_et_companyName)
    EditText invoiceEtCompanyName;
    @BindView(R.id.invoice_et_content)
    EditText invoiceEtContent;
    @BindView(R.id.invoice_tv_money)
    TextView invoiceTvMoney;
    @BindView(R.id.invoice_et_receive)
    EditText invoiceEtReceive;
    @BindView(R.id.textView)
    TextView textView;
    @BindView(R.id.invoice_et_phone)
    EditText invoiceEtPhone;
    @BindView(R.id.invoice_et_address)
    EditText invoiceEtAddress;
    @BindView(R.id.invoice_tv_rule)
    AutoLinearLayout invoiceTvRule;
    @BindView(R.id.invoice_tv_commit)
    TextView invoiceTvCommit;
    @BindView(R.id.activity_invoice_settlement)
    AutoLinearLayout activityInvoiceSettlement;
    private Context mContext = this;

    @Override
    public int getLayoutId() {
        return R.layout.activity_invoice_settlement;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimaryWhite), 0,true);
    }

    private void commitInvoice() {
        ApiStore.getInstance().getApiService(UrlConstant.Request.BASE_URL).commitInvoice(MyApplication.getInstance().getRequestFieldMap()).enqueue(new Callback<CommitInvoiceBean>() {
            @Override
            public void onResponse(Call<CommitInvoiceBean> call, Response<CommitInvoiceBean> response) {
                if (response.isSuccessful() && response.body() != null) {

                }
            }

            @Override
            public void onFailure(Call<CommitInvoiceBean> call, Throwable t) {
                ToastCompat.makeText(mContext, getResources().getString(R.string.badNetwork), Toast.LENGTH_SHORT).show();
            }
        });
    }

    @OnClick({R.id.return_myInvoice_commit, R.id.invoice_tv_rule, R.id.invoice_tv_commit})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.return_myInvoice_commit:
                break;
            case R.id.invoice_tv_rule:
                break;
            case R.id.invoice_tv_commit:
                commitInvoice();
                break;
        }
    }
}
